package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicProductionDailyDAO;
import com.cssy.xxkj.logic.entity.LogicProductionDailyDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-09-30
 */
public class LogicProductionDailyDAOImpl extends SqlMapClientDaoSupport implements LogicProductionDailyDAO {

    /**
     * 插入数据
     * @param logicProductionDailyDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionDailyDO(LogicProductionDailyDO logicProductionDailyDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicProductionDaily.insert", logicProductionDailyDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionDailyDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionDailyDOByExample(LogicProductionDailyDO logicProductionDailyDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDaily.countByDOExample", logicProductionDailyDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionDailyDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionDailyDO(LogicProductionDailyDO logicProductionDailyDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicProductionDaily.update", logicProductionDailyDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionDailyDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionDailyDO> findListByExample(LogicProductionDailyDO logicProductionDailyDO) throws DataAccessException {
        List<LogicProductionDailyDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDaily.findListByDO", logicProductionDailyDO);
        return list;
    }

    /**
     * 根据主键获取logicProductionDailyDO
     * @param id
     * @return logicProductionDailyDO
     */
    public LogicProductionDailyDO findLogicProductionDailyDOByPrimaryKey(String id) throws DataAccessException {
        LogicProductionDailyDO logicProductionDailyDO = (LogicProductionDailyDO) getSqlMapClientTemplate().queryForObject("LogicProductionDaily.findByPrimaryKey", id);
        return logicProductionDailyDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionDailyDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionDaily.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionDailyDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionDailyDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDaily_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDaily_ex.count", scs);
        return count;
	}
	
	@Override
	public List<LogicProductionDailyDO> findByRole(SearchConditions scs) throws DataAccessException{
		List<LogicProductionDailyDO> list = getSqlMapClientTemplate().queryForList("LogicProductionDaily_ex.findByRole", scs);
        return list;
	}
    
	@Override
    public Integer countByRole(SearchConditions scs) throws DataAccessException{
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionDaily_ex.countByRole", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionDaily_ex.deleteBizRemoved", id);
        return rows;
	}

}